package cn.enited.devtools.apiaggregator.vo;

import cn.enited.devtools.apiaggregator.validator.group.PagingValidationGroup;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotNull;

@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DefaultPageParamVo extends PageableParamVo {
    private static final long serialVersionUID = 6898144860865086811L;

    @Getter
    @Setter
    @NotNull(groups = {PagingValidationGroup.class}, message = "缺少当前页码")
    private Integer pageNumber;
    @NotNull(groups = {PagingValidationGroup.class}, message = "缺少显示每页数量")
    private Integer pageSize;


    @Override
    public Integer getOneBasedPageNumber() {
        return getPageNumber();
    }

    @Override
    public void setOneBasedPageNumber(Integer pageNumber) {
        setPageNumber(pageNumber);
    }

    @Override
    public Integer getPageSize() {
        return this.pageSize;
    }

    @Override
    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
}
